<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<import type="js" file="js.jquery" />
<import type="js" file="js.common" />
<import type="css" file="css.global" />
<import type="css" file="css.form" />
</head>
<body>
<div class="search"><b>消息列表</b>
<input type="button" value="标记为已读" class="button" onclick="over()" >
<input type="button" value="标记为未读" class="button" onclick="wait()" >
<input type="button" value="删除消息" class="button" onclick="del()" >
</div>
<div class="list">
<table class="stripe" cellspacing="0">
    <thead>
        <tr>
        	<th style="min-width: 30px;"><input type="checkbox" name="checkid" onclick="if(this.checked==true) { checkAll('key[]'); } else { clearAll('key[]'); }" ></th>
            <th width="72%">内容</th>
            <th width="15%">时间</th>
            <th width="10%">操作</th>
        </tr>
    </thead>
 
    <tbody>
      <volist name="data" id="vo" empty="$empty">
        <tr>
        	<td><input type="checkbox" name="key[]" value="{$vo.id}"></td>
            <td><if condition="$vo['status'] eq 1"><span class="content" value="{$vo.id}"><b>{$vo.content}</b></span><else />{$vo.content}</if></td>
            <td>{$vo.time}</td>
            <td><a href="javascript:void(0);" onclick="del({$vo.id});" title="删除" >删除</a></td>
        </tr>
      </volist>
    </tbody>
</table>
</div>
<div class="page">{$page}</div>
</body>
</html>
<script language="javascript">
$(document).ready(function(){  
	$(".stripe tr").mouseover(function(){    
	  $(this).addClass("over");}).mouseout(function(){   
			$(this).removeClass("over");}) 
  	$(".stripe tr:even").addClass("alt");
	$(".content").click(function(){
		over($(this).attr("value"));
	});
});   
var url = "__APP__/Sms/";
function over(id){
	if(id == undefined){
		id = check();
	}
	if(id == '' || id == undefined){alert("请至少选择一项！");return false;}
	$.get(url+"over?id="+id, function(result){
		location.reload();
	});
}
function wait(){
	var id = check();
	if(id == ''){alert("请至少选择一项！");return false;}
	$.get(url+"wait?id="+id, function(result){
		location.reload();
	});
}
function del(id){
	if(id == undefined){
		id = check();
	}
	if(id == '' || id == undefined){alert("请至少选择一项！");return false;}
	if(confirm("确定要删除该信息么？删除之后无法恢复！")){
		$.get(url+"delete?id="+id, function(result){
			location.reload();
		});
	}else{
		return false;
	}
}
function check(){
	var id = "";
	$("input[name='key[]']:checkbox:checked").each(function(){
		id+=$(this).val()+",";
	});
	return id;
}
</script>  